<!DOCTYPE html>
<html>
<head>
	<#include "/pages/templet/head.html"/>
	<SCRIPT type="text/javascript">
		var setting = {
			data: {
				simpleData: {
					enable: true
				}
			},
			callback: {
				//onCollapse: alert("up"),
				onExpand: function(){
					if (treeNiceScroll) {
						treeNiceScroll.resize();
					}
				}
			},
			view: {
				showLine: false
			}
		};
		var zNodes1 =[
			{ id:"0", pId:"0", name:"事件管理器", open:true , url:"/${orgi}/design/event/0/index.html", target:"_self"}
			<#if categories??>
			<#list categories as cate>
			,{ id:"${cate.id!''}", pId:"${cate.parentid!''}", name:"${cate.name!''}", icon:"/assets/images/icon-file-closed.png",url:"/${orgi}/design/event/${cate.id!''}/jobdetail.html" , target:"_self"}
			</#list>
			</#if>
		];
		$(document).ready(function(){
			var ztree = $.fn.zTree.init($(document.getElementById("zTree_adminLIst")), setting, zNodes1);
			ztree.selectNode(ztree.getNodeByParam("id", "${parentid!''}", null));
			
		});
		function submitDelForm(){
			if($("input[name='reportids']:checked").length>0){
				art.confirm('您确定要删除这些项吗？' 
				, function(){
					$("#mainForm").attr("action","");
					$("#mainForm").submit();
				} 
				, function(){})
				
			}else{
				alertMsg("请选择要删除的项！");
			}
		}
		function submitSearchForm(action){
			$("#beginNum").val($("#beginNumShow").val());
			$("#endNum").val($("#endNumShow").val());
			$("#jobname").val($("#show_jobname").val());
			$("#action").val(action);
			$("#mainForm").submit();
		} 
		
		function deljob(id , type){
			if(type == "1"){
				art.confirm('任务包含增量数据结算，删除该任务将同时删除结算后的数据，请确认是否删除？' 
				, function(){
					var url ="/${orgi}/design/event/${parentid}/"+id+"/jobdetaildel.html";
					$("#mainForm").attr("action",url);
			    	$("#mainForm").submit();
				} 
				, function(){});
			}else{
			    art.confirm('您确定要删除该项吗？' 
				, function(){
					var url ="/${orgi}/design/event/${parentid}/"+id+"/jobdetaildel.html";
					$("#mainForm").attr("action",url);
			    	$("#mainForm").submit();
				} 
				, function(){});			
			}
			
		}
	</SCRIPT>

</head>
<body>
<div class="container rs_layout" wrapper="true"><!-- Everything started here -->
	<div class="rs_layout_top" style="height:65px;">
		<div class="nav_top"><!--NavTop-->
			<#include "/pages/templet/headmenu.html"/>
		</div>
		<ul class="nav_tapWrap">
			<li class="nav_tapIthems cur"><a href="#"><i class="tabIcon"></i>事件管理器</a></li>
			<!-- <li class="nav_tapIthems "><a href="#"><i class="tabIcon"></i>任务管理器</a></li> -->
		</ul>
	</div>
	<div class="rs_layout_center reTabcon">
		<div class="rs_layout rTablayer show">
			<div class="rs_layout_top breadCrumbWrap">
				<div class="breadCrumbStart">您当前的位置是在：</div>
				<ul class="breadCrumb">
					<li class="bc_ithems"><a href="#">系统</a></li>
					<li class="bc_ithems"><a href="/${orgi}/design/event/0/index.html">计划任务管理</a></li>
				</ul>
				<ul class="controlButtons" style="float: right;">
					<#if cate?? && cate.catetype == 'table'>
						<li class="cbtn-icon-35" data-toggle="ajax" id="newdic" data-width="600" data-height="300" href="/${orgi}/design/event/${parentid!''}/selcube.html" title="选择数据模型"></li>
					<#elseif cate?? && cate.catetype == 'event'>
						<li class="cbtn-icon-135" data-toggle="ajax" id="newdic" data-width="500" data-height="300" href="/${orgi}/design/event/${parentid!''}/report.html" title="创建新任务"></li>
					<#elseif cate?? && cate.catetype == 'dataex'>
						<li class="cbtn-icon-49" data-toggle="ajax" id="newdic" data-width="600" data-height="300" href="/${orgi}/design/event/${parentid!''}/dataex/0.html" title="创建数据迁移任务"></li>
					<#elseif cate?? && cate.catetype == 'import'>
						<li class="cbtn-icon-49" data-toggle="ajax" id="newdic" data-width="600" data-height="300" href="/${orgi}/design/event/${parentid!''}/import.html" title="从文件系统导入CSV格式数据到数据表"></li>
					<#elseif cate?? && cate.catetype == 'process'>
						<li class="cbtn-icon-49" data-toggle="ajax" id="newdic" data-width="600" data-height="300" href="/${orgi}/design/event/${parentid!''}/process.html" title="执行本地操作系统命令或脚本"></li>
					</#if>
				</ul>
				<div style="float: right">
					<input style="margin-top: 4px;border: 1px solid #cccccc;height: 14px;padding: 4px;" size="25" id="show_jobname" maxlength="30" name="show_jobname" value="${jobname!''}" type="text">
					<span class="help-inline"></span>
					<span class="btnWrap" style="margin-top:20px;">
						&nbsp;&nbsp;<input type="button" style="padding-top:5px" onclick="$('#beginNumShow').val('1');$('#endNumShow').val('20');submitSearchForm('current');" class="subButtonStyle" value="查询"> 
					</span>
				
				</div>
			</div>
			<div class="rs_layout_left" resizable="true" style="width:230px;">
				<div class="lftTreeWrap">
					<div class="ztree" id="zTree_adminLIst"></div>
				</div>
			</div>
		<!--<div class="rs_layout_right" style="width:300px;"></div>-->
			<div class="rs_layout_center">
			
				<div class="rs_layout">
					<div class="rs_layout_center">
						<div class="tableScrollWrap">
						<form id="mainForm" action="/${orgi}/design/event/${parentid!''}/jobdetail.html" data-toggle="form" method="post">
							<input type="hidden" id="beginNum" name="beginNum" value="">
							<input type="hidden" id="endNum" name="endNum" value="">
							<input type="hidden" id="action" name="action" value="current">
							<input type="hidden" id="jobname" name="jobname" value="${jobname!''}">
							<table class="table_style_1">
								<thead>
									<tr>
										<th style="width:30px;"></th>
										<th><i class="verMidWrap">名称</i><i class="tbArrow"></i></th>
										<th class="minSize">执行计划</th>
										<th class="minSize">执行方式</th>
										<th class="minSize"><i class="verMidWrap">上次执行时间</i><i class="tbArrow"></i></th>
										<th class="minSize minIsHide"><i class="verMidWrap">下次执行时间</i><i class="tbArrow"></i></th>
										<th class="minSize">操作</th>
									</tr>
								</thead>
								<tbody>
									<#if pages ??>
										<#list pages as job>
											<tr>
												<td>	
													<input type="checkbox" name ="">
												</td>
												<td>
													<a href="/${orgi}/manage/task/${job.id!''}/taskruninglist.html" data-toggle="ajax" data-width="750" title="${job.name!''}">
													<i class="icons_tablelist_task"></i>
													${job.name!""}</a>
												</td>
												<td class="minSize"><#if job.cronexp ??>${job.cronexp!''}</#if></td>
												<td class="minSize"><#if job.plantask ??&&job.plantask>后台执行<#else>手动执行</#if></td>
												<td class="minSize"><#if job.taskfiretime ??>${job.taskfiretime?string("yyyy年MM月dd日 HH:mm:ss")}</#if></td>
												<td class="minSize"><#if job.nextfiretime ??>${job.nextfiretime?string("yyyy年MM月dd日 HH:mm:ss")}</#if></td>
												<td class="minSize"> 													
													<#if job.taskstatus ?? && job.taskstatus =="0">
														<#if cate?? && cate.catetype == 'event'>
														<a href="/${orgi}/design/event/${job.id}.html" target="event_design"><i class="tbControlIcon tci-19" title="使用任务设计器编辑任务"></i></a>
														</#if>
														<a href="/${orgi}/design/event/${parentid}/${job.id}/start.html"><i class="tbControlIcon tci-11" title="运行"></i></a>
														<a href="javascript:void(0)" onclick="deljob('${job.id}' , '<#if job.clazz?? && job.clazz == '1'>1<#else>0</#if>')"><i class="tbControlIcon tci-14" title="删除"></i></a>
														<a data-toggle="ajax" data-width="550" title="执行计划" href="/${orgi}/design/event/${parentid}/${job.id}/taskadd.html"><i class="icons_tablelist icons_tablelist_plan" title="执行计划"></i></a>
														<#if job.tasktype == 'process'>
															<a href="/${orgi}/design/event/${parentid}/processedit.html?id=${job.id!''}"  data-toggle="ajax" id="newdic" data-width="600" data-height="300" title="编辑 ${job.name!''}"><i class="tbControlIcon tci-8" title="修改"></i></a>
														</#if>
													<#else >
														<#if job.fetcher == true>
															<#if job.pause == true>
																<a onclick="art.confirm('您确定要继续该任务吗？' , function(){location.href='/${orgi}/design/event/${parentid}/${job.id}/jobdetailedit.html?stoptype=continue'} , function(){})" href="javascript:void(0)"><i class="tbControlIcon tci-15" title="继续"></i></a>
															<#else>
																<a onclick="art.confirm('您确定要挂起该任务吗？' , function(){location.href='/${orgi}/design/event/${parentid}/${job.id}/jobdetailedit.html?stoptype=hang'} , function(){})" href="javascript:void(0)"><i class="tbControlIcon tci-9" title="挂起"></i></a>
															</#if>
															<a onclick="art.confirm('您确定要停止该任务吗？' , function(){location.href='/${orgi}/design/event/${parentid}/${job.id}/jobdetailedit.html?stoptype=stop'} , function(){})" href="javascript:void(0)"><i class="tbControlIcon tci-10" title="停止"></i></a>
														<#else>
															<font color='red'>任务正在停止......</font>
														</#if>
													</#if>
												</td>
											</tr>
										</#list>
									</#if>
								</tbody>
							</table>
							</form>
						</div>
					</div>
					<div class="rs_layout_bottom toolBar_bottom" style="overflow: hidden;">
						<div class="papers_1" style="float:left;line-height:18px;margin:0 10px 0 500px;">
							<span ><label style="font-size: 13px;">条目&nbsp;&nbsp;&nbsp;&nbsp;</label><input type="text" style="width: 30px;height: 10px;" id="beginNumShow" value="${beginNum!'1'}"/><label style="font-size: 13px;">-</label><input style="width: 30px;height: 10px;" type="text" id="endNumShow" value="${endNum!'20'}"/></span>
							<img class="pageElems" onclick="submitSearchForm('current');" title="查询" alt="查询" src="/assets/images/action_go.gif"/>
							<img class="pageElems" onclick="submitSearchForm('first');" title="首页" alt="首页" src="/assets/images/go-first-view.png"/>
							<img class="pageElems" onclick="submitSearchForm('last');" title="上一页" alt="上一页" src="/assets/images/go-previous-view.png"/>			
							<img class="pageElems" onclick="submitSearchForm('next');" title="下一页" alt="下一页" src="/assets/images/go-next-view.png"/>
							<img class="pageElems" onclick="submitSearchForm('final');" title="尾页" alt="尾页" src="/assets/images/go-last-view.png"/>
						</div>
						<ul class="toolbarBottom_IconWrap">
							<li onclick="submitDelForm();" class="tb-icons-4"></li>
						</ul>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
</body>
</html>